package com.zhentao.controller;

import com.zhentao.model.common.business.dto.BusinessLoginDto;
import com.zhentao.model.common.business.dto.BusinessRegisterDto;
import com.zhentao.model.common.business.pojo.BusinessUser;
import com.zhentao.model.common.dtos.ResponseResult;
import com.zhentao.service.BusinessUserService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/login")
public class BusinessLoginController {
    @Resource
    BusinessUserService businessUserService;

    /**
     * 商家登录
     * @param dto
     * @return
     */
    @PostMapping("/in")
    public ResponseResult login(@RequestBody BusinessLoginDto dto) {
        System.out.println("输入的dto = " + dto);
        return businessUserService.login(dto);
    }
    /**
     * 商家注册
     * @param
     * @return
     */
    @PostMapping("/register")
    public ResponseResult register(@RequestBody BusinessRegisterDto dto) {
        return businessUserService.register(dto);
    }


}
